<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  </head>
  <body>
    <style>
      /* ul > li.item {
        color: red;
      } */
      ul > li:nth-child(-n + 3) {
        color: green;
      }
    </style>
    <ul>
      <li class="item">1</li>
      <li class="item">2</li>
      <li class="item">3</li>
      <li>4</li>
      <li>5</li>
      <li>6</li>
    </ul>

    <style>
      input:valid {
        /* background: green; */
      }
      input:invalid {
        /* background: red; */
      }
      input:required {
        border: solid 1px red;
      }
    </style>
    <form action="">
      <input type="text" name="name" required /> 名称
      <input type="email" />
      <button>提交</button>
    </form>
  </body>
</html>
